#ifndef UDP_SERVER_INCLUDED
#define UDP_SERVER_INCLUDED

#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <iostream>
#include "com.pb.h"

class udp_server {
public:
	udp_server(int port = 0);
	int getPort();
	com::Block getBlock();
	struct in_addr getClientIP();
private:
	int m_sockfd,m_n;
	struct ip_mreq m_imreq;
	struct sockaddr_in m_servaddr,m_cliaddr;
	int m_port;
	struct in_addr m_clientIP;
};

#endif

